Skip to content

Kernel/user partition, Phase 5 part 4: remove the clock change notification and the XTOS LL scheduler - #11513

Draft
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase5d
Draft

lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase5d

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Phase 5 of #11306 (kernel / user-space partition), fourth part: remove the clock change notification, which nothing sends, and the XTOS LL scheduler, its only receiver.

Background

The notifier has two clock events, NOTIFIER_ID_CPU_FREQ and NOTIFIER_ID_SSP_FREQ, with a struct clock_notify_data payload.

  • Senders: none. No clock driver sends either event.
  • Receivers: only the XTOS LL scheduler (ll_schedule_xtos.c). It registers to recalculate the start times of its tasks when the clock changes.
  • Clock tables: every platform sets notification_id and notification_mask in its struct clock_info, but nothing reads them.

The notifier is not usable from user space, and Phase 5 removes it. These events are dead, so they go first.

The XTOS LL scheduler is the last scheduler left from the XTOS firmware build, which has been removed: Zephyr is the only supported RTOS. Only ACP 6.0 still builds it, when its DMA domain is off (the default). All other platforms use the Zephyr LL scheduler.

Patches

  1. schedule: remove the XTOS LL scheduler.
    • ACP 6.0 enables the DMA domain, so it uses the Zephyr LL scheduler with the Zephyr DMA domain. That configuration was already supported for it.
    • The platform code needs no change: on Zephyr, scheduler_init_ll(), timer_domain_init() and dma_multi_chan_domain_init() already map to the Zephyr scheduler and domains.
    • The Zephyr LL scheduler and its kernel half are now built for every platform.
  2. clk: remove notification_id and notification_mask from struct clock_info, in the Zephyr and host rtos/clk.h. Also remove the notifier.h includes that only the clock tables needed (the Zephyr, i.MX, AMD and MTK platforms), and the one the generic clock code (src/kernel/lib/clk.c) kept from when clock_set_freq() sent the notification.
  3. notifier: remove NOTIFIER_ID_CPU_FREQ, NOTIFIER_ID_SSP_FREQ, NOTIFIER_CLK_CHANGE_ID(), struct clock_notify_data, and CLOCK_NOTIFY_PRE and CLOCK_NOTIFY_POST.
    • The notifier checked and walked the event IDs from NOTIFIER_ID_CPU_FREQ, which was 0; it now starts from 0.
    • The other IDs are renumbered. They are internal to the firmware.

Functional change

  • ACP 6.0 uses the Zephyr LL scheduler and DMA domain. ACP 6.0 does not build on main (the IPC3 DAI code and the HS DAI driver fail to compile), so this has not run. Its errors are unchanged.
  • Other platforms: none.

LLEXT modules

notifier_register() and notifier_unregister() are exported to LLEXT modules, and they take an event ID. The renumbering changes those IDs, so LLEXT modules that use the notifier, built against the old headers, must be rebuilt. The in-tree modules are rebuilt with the firmware.

Not in this part

  • SOF_SCHEDULER_FREE_IRQ_ONLY, and the flags argument of the scheduler free operation, have no user left after patch 1. Removing them changes the scheduler API, so that is a separate cleanup.
  • Other XTOS leftovers:
    • stale comments, header guards and #error texts that name XTOS: a separate cleanup;
    • Kconfig.xtos: options the legacy driver platforms still select, removed with the legacy drivers;
    • the _xtos_* interrupt calls: the legacy SOF interrupt API, which only the AMD platforms without native drivers use, removed with the legacy drivers.
  • NOTIFIER_ID_VAD has no receiver in the tree either, but it is the only output of the webrtc_vad module, and webrtc_ns2 can send it too. Removing it needs a decision on how these modules report voice activity, so it is left for a later part.

Testing

  • Per commit, compared with main:
    • Builds: tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95 and qemu_xtensa, and the extra CI configurations:
      • native_sim IPC3/IPC4 stub builds;
      • imx93 64-bit;
      • PTL with each userspace overlay;
      • PTL with CONFIG_SOF_USERSPACE_PROXY=n;
      • PTL and MTL with os_linux_overlay.conf;llext_relocatable.conf;
      • PTL and TGL with app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.
    • Object changes: as expected, and nothing else:
      • patch 1: none, because only ACP 6.0 built the XTOS LL scheduler. On ACP 6.0 the Zephyr LL scheduler, the Zephyr DMA domain and the platform code compile, and the error set is unchanged;
      • patch 2: clk.c of each platform. In the images, only the functions that index the clock tables change (platform_clock_init(), clock_get_freq(), clock_set_freq(), and core_kcps_adjust() on MTL), because struct clock_info is 8 bytes smaller;
      • patch 3: notifier.c, and the callers of the notifier, whose event ID constants are renumbered (DAI, KPB, the KPB service, the detect test, mic privacy).
    • Signing: rimage runs for every Intel platform, and the generated configs are unchanged.
    • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.
    • ZTest: the unit tests pass, run as in CI (22 of 22 configurations).
    • Host: the host library and the cmocka unit tests build and pass.
  • At the tip:
    • the testbench and the tools pass;
    • the host library and the cmocka unit tests pass for all nine defconfigs and the library config;
    • the include checker passes with --strict, for the builds (same 16 baseline sources) and for the sources;
    • the platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365) have unchanged error sets.

All of the above, and the documentation build as in CI (no warnings, at every commit), was run on d9b1a78 (current main).

Changes since the last push

  • XTOS (review): patch 1 now removes the XTOS LL scheduler instead of only its clock change registration. ACP 6.0 moves to the Zephyr LL scheduler.
  • Review:
    • src/kernel/lib/clk.c drops its notifier.h include too (patch 2);
    • the rtos/clk.h file description no longer mentions notifications (patch 3);
    • a note on LLEXT modules (see "LLEXT modules").

🤖 Generated with Claude Code

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Clean, well-split, bisectable 3-commit removal of the dead clock-change notification (NOTIFIER_ID_CPU_FREQ, NOTIFIER_ID_SSP_FREQ, NOTIFIER_CLK_CHANGE_ID(), struct clock_notify_data, CLOCK_NOTIFY_PRE/POST, and struct clock_info::notification_{id,mask}).

Verified across the tree:

  • Zero remaining senders, receivers, or struct clock_info initializers reference the removed symbols.
  • All remaining notifier_{register,unregister,event}() callsites (including CMocka notifier_mocks.c) use symbolic NOTIFIER_ID_* enumerators and 0 .. NOTIFIER_ID_COUNT - 1 bounds.
  • Casting (unsigned int)type < NOTIFIER_ID_COUNT in notifier_{register,unregister}() cleanly avoids -Wtype-limits when the enum's underlying type is unsigned while still catching negative integers.
  • Commit prefixes/messages, Signed-off-by: trailers, CI checks, and strict Doxygen (WARN_AS_ERROR = FAIL_ON_WARNINGS) all pass with no blocking issues.

Minor Cleanup / Follow-up Notes

  1. src/kernel/lib/clk.c:13 (unmodified in PR): Still has an unused #include <sof/lib/notifier.h> left over from when clock_set_freq() used to post clock notifications — could be dropped alongside Commit 2 (clk: remove the notification fields from struct clock_info), which removes the same unused header from zephyr/lib/clk.c and the platform clk.c files.
  2. src/schedule/ll_schedule_xtos.c: Unused #include <rtos/clk.h> at line 15, double blank line at lines 758–759, and SOF_SCHEDULER_FREE_IRQ_ONLY (in src/include/sof/schedule/schedule.h:76) now having zero remaining consumers in the tree.
  3. zephyr/include/rtos/clk.h:8: File-level Doxygen @brief still mentions "and notification interfaces".
  4. src/include/sof/lib/notifier.h:23: Informational LLEXT ABI note on enum notify_id renumbering (EXPORT_SYMBOL(notifier_register) / EXPORT_SYMBOL(notifier_unregister)).

Comment thread src/schedule/ll_schedule_xtos.c Outdated
@@ -15,7 +15,6 @@
#include <rtos/clk.h>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (unused include): <rtos/clk.h> was only needed here for struct clock_notify_data and CLOCK_NOTIFY_POST (sof_cycle_get_64*() comes from <rtos/timer.h> on line 13), so this include can be dropped too:

Suggested change
#include <rtos/clk.h>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole file is gone now: patch 1 removes the XTOS LL scheduler, see the reply to your XTOS comment.

Comment thread src/schedule/ll_schedule_xtos.c Outdated
Comment on lines 736 to 739

domain_unregister(sch->domain, NULL, 0);

if (!(flags & SOF_SCHEDULER_FREE_IRQ_ONLY))
notifier_unregister(sch, NULL,
NOTIFIER_CLK_CHANGE_ID(sch->domain->clk));

irq_local_enable(irq_flags);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up note: scheduler_free_ll() was the last consumer of SOF_SCHEDULER_FREE_IRQ_ONLY (defined in src/include/sof/schedule/schedule.h:76) — and of the flags parameter on scheduler_ops::scheduler_free — anywhere in the tree (tools/testbench/utils.c:208 only calls schedule_free(0)). Fine to leave for a separate cleanup patch if preferred.

(Also minor nit at lines 758–759 below: removing notifier_register() left two consecutive blank lines before return 0;.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is removed in patch 1, so the blank lines go with it. SOF_SCHEDULER_FREE_IRQ_ONLY and the flags argument of the scheduler free operation now have no user. Removing them changes the scheduler API, so I left that for a separate cleanup; it is listed under "Not in this part" in the description.

Comment thread zephyr/include/rtos/clk.h
uint32_t message;
};

struct freq_table {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc nit (line 8 above): Now that CLOCK_NOTIFY_*, struct clock_notify_data, and notification_{id,mask} are removed from this header, consider updating the @file Doxygen brief at line 8 (@brief RTOS DSP clock frequency management and notification interfaces.) to drop "and notification".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in patch 3: the description now reads "RTOS DSP clock frequency management interfaces."

enum notify_id {
NOTIFIER_ID_CPU_FREQ = 0, /* struct clock_notify_data * */
NOTIFIER_ID_SSP_FREQ, /* struct clock_notify_data * */
NOTIFIER_ID_KPB_CLIENT_EVT, /* struct kpb_event_data * */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note (LLEXT symbol ABI): All in-tree callers use symbolic NOTIFIER_ID_* constants, so renumbering from 0 is completely safe for in-tree builds. Just noting that since notifier_register and notifier_unregister are exported via EXPORT_SYMBOL() (src/lib/notifier.c:70,107), any cached/standalone .llext binaries (copier, kpb) compiled against pre-#11513 headers must be rebuilt (expected, especially as notifier is internal and being removed in Phase 5).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I added an "LLEXT modules" section to the description: LLEXT modules that use the notifier must be rebuilt against the new headers, and the in-tree modules are rebuilt with the firmware.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the xtos logic is no longer used in main as Zephyr is the only supported RTOS, could this vbe further simplified with full xtos removal at this stage ?

lrgirdwo and others added 3 commits November 21, 2026 16:29
The XTOS LL scheduler (ll_schedule_xtos.c) is the last scheduler left
from the XTOS firmware build, which has been removed: Zephyr is the only
supported RTOS. ACP 6.0 is the only platform that still builds it, when
the DMA domain is off, which is its default. All other platforms use the
Zephyr LL scheduler (zephyr_ll.c).

Remove it and enable the DMA domain on ACP 6.0, so ACP 6.0 uses the
Zephyr LL scheduler with the Zephyr DMA domain, the configuration that
was already supported for it. The platform code needs no change: on
Zephyr, scheduler_init_ll(), timer_domain_init() and
dma_multi_chan_domain_init() already map to the Zephyr scheduler and
domains. The Zephyr LL scheduler and its kernel half are now built for
every platform.

ACP 6.0 does not build on main (the IPC3 DAI code and the HS DAI driver
fail to compile), and its errors are unchanged.

The XTOS LL scheduler also registered for the clock change notification,
which nothing sends. It was the only receiver, so this is also part of
removing the notifier, which is not usable from user space (Phase 5 of
the kernel / user-space partition).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Every platform sets notification_id and notification_mask in its clock
information, to NOTIFIER_ID_CPU_FREQ and its core mask, but nothing reads
them: no clock driver sends a clock change notification. Remove the
fields, and the notifier.h includes that only the clock tables needed.
The generic clock code (src/kernel/lib/clk.c) included notifier.h too,
left from when clock_set_freq() sent the notification, so drop it there
as well.

This is part of removing the notifier, which is not usable from user
space (Phase 5 of the kernel / user-space partition).

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Nothing sends NOTIFIER_ID_CPU_FREQ or NOTIFIER_ID_SSP_FREQ, and nothing
registers for them any more. Remove the event IDs,
NOTIFIER_CLK_CHANGE_ID(), and the notification payload struct
clock_notify_data with its CLOCK_NOTIFY_PRE and CLOCK_NOTIFY_POST
messages.

The notifier checked and walked the IDs from NOTIFIER_ID_CPU_FREQ, which
was 0. It now starts from 0. The other IDs are renumbered; they are
internal to the firmware.

This is part of removing the notifier, which is not usable from user
space (Phase 5 of the kernel / user-space partition).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood lgirdwood changed the title Kernel/user partition, Phase 5 part 4: remove the clock change notification Kernel/user partition, Phase 5 part 4: remove the clock change notification and the XTOS LL scheduler Nov 21, 2026
@lgirdwood

lgirdwood commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Updated, re-verified on d9b1a78:

  • XTOS: patch 1 now removes the XTOS LL scheduler (ll_schedule_xtos.c). Only ACP 6.0 still built it, when its DMA domain is off. ACP 6.0 now enables the DMA domain, so it uses the Zephyr LL scheduler with the Zephyr DMA domain, like the other platforms use the Zephyr LL scheduler. The platform code needs no change. ACP 6.0 does not build on main (IPC3 DAI and HS DAI errors), and its error set is unchanged. The scheduler, DMA domain and platform code compile there.
  • src/kernel/lib/clk.c: its notifier.h include is dropped too (patch 2).
  • Other XTOS leftovers, listed in the description:
    • the stale comments, header guards and #error texts that name XTOS go in a separate cleanup;
    • Kconfig.xtos goes with the legacy drivers;
    • the _xtos_* interrupt calls go with the legacy drivers: they are the legacy SOF interrupt API, which only the AMD platforms without native drivers use (corrected: I first wrote i.MX here, but i.MX uses the Zephyr interrupt API).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants